#include <iostream>

using namespace std;

struct B;
struct A
{
	B* operator->();
	const char* operator->*(const char* B::*ch);
};

struct B
{
	int i1 = 1;
	int i2 = 2;
	const char* ch = "hello";
};

B* A::operator->() { return new B(); }
const char* A::operator->*(const char* B::* ch) { return new B->*ch; }

int main()
{
	auto ch = &B::ch;
	A a;
	B* pB = new B;
	std::reference_wrapper<A> aRW = a;

	cout << pB->*ch << endl;
	cout << a->*ch << endl;

	return 0;
}